<admintpl file="header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <form action="{:U('Article/content')}" method="post" id="content-from" class="form-horizontal js-ajax-forms"
          enctype="multipart/form-data">
        <input type="hidden" name="type" value="{:I('request.type/s','')}">
        <div class="row-fluid">
            <div class="span9">
                <script type="text/plain" id="content" name="content">{$article.content}</script>
            </div>
        </div>
        <div class="form-actions">
            <button class="btn btn-primary js-ajax-submit" id="sb_btn" type="button">提交</button>
        </div>
    </form>
</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
        /////---------------------
        Wind.use('ajaxForm', 'artDialog', function () {
            //编辑器
            editorcontent = new baidu.editor.ui.Editor({initialFrameHeight:400,initialFrameWidth:800 });
            editorcontent.render('content');
            try {
                editorcontent.sync();
            } catch (err) {
            }

            var form = $('form.js-ajax-forms');
            var formloading = false;
            $("#sb_btn").click(function(){
                if (formloading)
                    return;
                $("#content-from").ajaxSubmit({
                    url: form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
                    dataType: 'json',
                    beforeSubmit: function (arr, $form, options) {
                        formloading = true;
                    },
                    success: function (data, statusText, xhr, $form) {
                        console.info(data);
                        formloading = false;
                        if (data.status) {
                            setCookie("refersh_time", 1);
                            //添加成功
                            Wind.use("artDialog", function () {
                                art.dialog({
                                    id: "succeed",
                                    icon: "succeed",
                                    fixed: true,
                                    lock: true,
                                    background: "#CCCCCC",
                                    opacity: 0,
                                    content: data.info
                                });
                            });
                        } else {
                            artdialog_alert(data.info);
                        }
                    }
                });
            });

        });
</script>
</body>
</html>